Let's create a function that will ask the player for their guesses.

  • Outside of the loop, add a Wait command so the stage pauses for 1 second.
  • Drag out Define Function. Name your function guess_code() and insert the parameter y in the parens.
  • Make an Empty List called guess and an Integer Variable named x with the value -125.
  • Use a Loop with Range that repeats 4 times to Ask the user to "Enter a color."
  • Change the variable that stores the user input to color_guess.

To navigate the page using the TAB key, first press ESC to exit the code editor.

# THIS ACTIVITY IS IN PREVIEW ONLY MODE
  • Run Code
  • Submit Work
  • Next Activity
  • Show Console
  • Reset Code Editor
  • Codesters How To (opens in a new tab)